package com.cheng.dubbo.nacos.demo.controller;

import com.cheng.dubbo.nacos.demo.EchoService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Api(tags = "demo-nacos-dubbo-consumer")
@RestController
@RequestMapping("/demo/dubbo/nacos/consumer")
public class EchoController {

    @DubboReference
    EchoService echoService;


    @ApiOperation("调用提供者回显")
    @GetMapping("/echo/{string}")
    public String echo(@PathVariable String string) {
        return "消费者rpc调用返回："+ echoService.echo(string);
    }
}
